<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Comparatif edition formulaire avec jQuery</title>

	<script type="text/javascript" 
		src="http://code.jquery.com/jquery-1.1.3.1.pack.js"/>
		
	<script>
	$(document).ready(function() {
		$(":button").click( function() {
			
			action = $(this).attr("id");

			$(":checkbox").each( function() { 
				switch (action) {
					case "1":
							this.checked = true;
						break;
					case "2":
							this.checked = false;
						break;
					case "3":
							this.checked = !this.checked;
				}
			})
			
		});
	});
	
	</script>

</head>

<body>

<form>                
<input id="1" type="button" value="Tout cocher">&nbsp;&nbsp;&nbsp;
<input id="2" type="button" value="Tout decocher">&nbsp;&nbsp;&nbsp;
<input id="3" type="button" value="Inverser la selection">

<br /><br />
	<input type="checkbox" name="checkbox1" id="checkbox1" value="1"><label for="checkbox1">Choix 1</label><br />
	<input type="checkbox" name="checkbox2" id="checkbox2" value="2"><label for="checkbox2">Choix 2</label><br />
	<input type="checkbox" name="checkbox3" id="checkbox3" value="3"><label for="checkbox3">Choix 3</label><br />
	<input type="checkbox" name="checkbox4" id="checkbox4" value="4"><label for="checkbox4">Choix 4</label><br />
	<input type="checkbox" name="checkbox5" id="checkbox5" value="5"><label for="checkbox5">Choix 5</label>
</form>

</body>
</html>